/*
    SUSAN® - Sole of Unix Save ANything

   Copyright (C) 2016-2019 Skyatlas co. ltd

   
*/

#ifndef BAREOS_DIRD_SD_CMDS_H_
#define BAREOS_DIRD_SD_CMDS_H_

class JobControlRecord;
class dlist;

namespace directordaemon {

class UaContext;
class StorageResource;

bool ConnectToStorageDaemon(JobControlRecord* jcr,
                            int retry_interval,
                            int max_retry_time,
                            bool verbose);
BareosSocket* open_sd_bsock(UaContext* ua);
void CloseSdBsock(UaContext* ua);
char* get_volume_name_from_SD(UaContext* ua,
                              slot_number_t Slot,
                              drive_number_t drive);
dlist* native_get_vol_list(UaContext* ua,
                           StorageResource* store,
                           bool listall,
                           bool scan);
slot_number_t NativeGetNumSlots(UaContext* ua, StorageResource* store);
drive_number_t NativeGetNumDrives(UaContext* ua, StorageResource* store);
bool CancelStorageDaemonJob(UaContext* ua, StorageResource* store, char* JobId);
bool CancelStorageDaemonJob(UaContext* ua,
                            JobControlRecord* jcr,
                            bool interactive = true);
void CancelStorageDaemonJob(JobControlRecord* jcr);
void DoNativeStorageStatus(UaContext* ua, StorageResource* store, char* cmd);
bool NativeTransferVolume(UaContext* ua,
                          StorageResource* store,
                          slot_number_t src_slot,
                          slot_number_t dst_slot);
bool NativeAutochangerVolumeOperation(UaContext* ua,
                                      StorageResource* store,
                                      const char* operation,
                                      drive_number_t drive,
                                      slot_number_t slot);
bool SendBwlimitToSd(JobControlRecord* jcr, const char* Job);
bool SendSecureEraseReqToSd(JobControlRecord* jcr);
bool DoStorageResolve(UaContext* ua, StorageResource* store);
bool SendStoragePluginOptions(JobControlRecord* jcr);

} /* namespace directordaemon */
#endif  // BAREOS_DIRD_SD_CMDS_H_
